home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / shared.dir / 03024_Script_GO SECTION < prev    next >
Text File  |  1996-06-21  |  13KB  |  423 lines

  1. -- ---------------------------------------------------------------
  2. -- Handler goSection is the handler use to go from one section in
  3. -- the product to another.
  4.  
  5. on goSection sectionName, scrollFlag
  6.   global sectionMovie, sectionFrame, currentsection
  7.   global maxNumButtons
  8.   set maxNumButtons = 3
  9.   
  10.   setMouseDownScriptEmpty -- Added by ET Oct. 2, 95
  11.   
  12.   addSectionToBackList(currentsection)
  13.   setBackFlag(FALSE)
  14.   setSectionButtonCursors("-1") -- reset the cursors of the old section
  15.   turnOffPuppet
  16.   setCurrentSection(sectionName)
  17.   setSectionInfo(sectionName)
  18.   resetSpriteCursors  -- for a frame in the same movie
  19.   removeSectionButtons(1,maxNumButtons)
  20.   goMovie(sectionMovie, sectionFrame)
  21.   removeVisibleButtons(1,maxNumButtons) -- Added by ET
  22.   setUpMenu
  23.   placeSectionButtonsOnStage
  24.   setOrientation(scrollFlag)
  25.   setMenuBackGroundCursor("fingerCursor")
  26.   setSectionButtonCursors("fingerCursor")
  27.   setSectionNavigationCursors
  28. end
  29.  
  30.  
  31.  
  32. -- Handler setCurrentSection sets the global variable currentSection
  33. -- to the given sectionName. (is this needed?)
  34.  
  35. on setCurrentSection sectionName
  36.   global currentSection
  37.   
  38.   set currentSection = sectionName
  39. end
  40.  
  41. -- ---------------------------------------------------------------
  42. -- ---------------------------------------------------------------
  43. -- Handler turnOffPuppet 
  44.  
  45. on turnOffPuppet
  46.   repeat with i = 1 to 48
  47.     puppetSprite i, FALSE
  48.   end repeat
  49. end
  50.  
  51. -- ---------------------------------------------------------------
  52. -- Handler setSectionInfo 
  53.  
  54. on setSectionInfo sectionName
  55.   set sectionInfo = getSectionInfo(sectionName)
  56.   if sectionInfo = "" then exit
  57.   
  58.   setSectionMovie(sectionInfo)
  59.   setSectionFrame(sectionInfo)
  60.   setLeftSection(sectionInfo)
  61.   setRightSection(sectionInfo)
  62.   setTopSection(sectionInfo)
  63.   setBottomSection(sectionInfo)
  64.   setParentSection(sectionInfo)
  65.   setNumSectionButtons(sectionInfo) -- needed to know how many buttons to place on stage
  66.   
  67.   
  68.   setButtonTextPositions
  69.   
  70.   -- get the text to be placed in the buttons
  71.   setButtonTexts(sectionInfo)
  72.   
  73.   -- get the section name to go to when each button is clicked. 
  74.   setButtonSections(sectionInfo)
  75.   
  76.   setSectionOrientation(sectionInfo)
  77. end
  78.  
  79. -- ---------------------------------------------------------------
  80. -- Handler goLeft goes to the current section's leftSection.
  81.  
  82. on goLeft
  83.   global leftSection
  84.   
  85.   -- check if the 3T`ent section has a leftSection
  86.   if sectionExists(leftSection) then
  87.     goSection(leftSection,0)
  88.   end if
  89. end
  90.  
  91. -- ---------------------------------------------------------------
  92. -- Handler goRight goes to the current section's rightSection.
  93.  
  94. on goRight
  95.   global rightSection
  96.   
  97.   -- check if the current section has a leftSection
  98.   if sectionExists(rightSection) then
  99.     goSection(rightSection,0)
  100.   end if
  101. end
  102.  
  103. -- ---------------------------------------------------------------
  104. -- Handler goTop goes to the current section's topSection.
  105.  
  106. on goTop
  107.   global topSection
  108.   -- check if the current section has a topSection
  109.   if sectionExists(topSection) then
  110.     goSection(topSection,0)
  111.   end if
  112. end
  113.  
  114. -- ---------------------------------------------------------------
  115. -- Handler goBottom goes to the current section's bottomSection.
  116.  
  117. on goBottom
  118.   global bottomSection
  119.   
  120.   -- check if the current section has a bottomSection
  121.   if sectionExists(bottomSection) then
  122.     goSection(bottomSection,0)
  123.   end if
  124. end
  125.  
  126. -- ---------------------------------------------------------------
  127. -- Handler goParent goes to the current section's parentSection.
  128.  
  129. on goParent
  130.   global parentSection
  131.   
  132.   -- check if the current section has a parentSection
  133.   if sectionExists(parentSection) then
  134.     goSection(parentSection)
  135.   end if
  136. end
  137.  
  138. -- ---------------------------------------------------------------
  139. -- Handler goButtonSection is called when the user clicks on one of 
  140. -- the 3 buttons on the menu bar. It goes to the appropriate section
  141. -- (determined by the global variables button1Section, button2Section
  142. -- and button3Section)
  143.  
  144. on goButtonSection buttonIndex
  145.   global listOfButtonSections
  146.   
  147.   set whichSection = getAt(listOfButtonSections,buttonIndex)
  148.   
  149.   -- check if the clicked button has a goTo section (should be if it is on stage
  150.   -- but do this for error checking anyway).
  151.   if sectionExists(whichSection) then
  152.     if whichSection = "TourSt" then
  153.       goTour
  154.     else
  155.       goSection(whichSection, 1)
  156.     end if
  157.   end if
  158. end
  159.  
  160. -- ---------------------------------------------------------------
  161. -- Handler placeSectionButtonsOnStage calls the handler placeButton
  162. -- to place on stage the buttons of the current section.
  163.  
  164. on placeSectionButtonsOnStage
  165.   global numSectionButtons, maxNumButtons
  166.   
  167.   if numSectionButtons then
  168.     placeButtonBackGroundOnStage(numSectionButtons)
  169.     
  170.     repeat with i = 1 to numSectionButtons
  171.       placeButton(i)
  172.     end repeat
  173.     --removeSectionButtons(numSectionButtons + 1,maxNumButtons)
  174.     --else   
  175.     --removeButtonBackGroundFromStage
  176.     --removeSectionButtons(1,maxNumButtons)
  177.   end if
  178. end
  179.  
  180. -- ---------------------------------------------------------------
  181. -- Handler setSectionButtonCursors calls the handler setButtonCursor
  182. -- to set the cursors of the buttons of the current section.
  183.  
  184. on setSectionButtonCursors whichCursor
  185.   global numSectionButtons, buttonBackGroundSprite
  186.   
  187.   set the cursor of sprite buttonBackGroundSprite = value(whichCursor)
  188.   
  189.   repeat with i = 1 to numSectionButtons
  190.     setButtonCursor(i, whichCursor)
  191.   end repeat
  192. end
  193.  
  194. -- ---------------------------------------------------------------
  195. -- Handler removeButtonBackGroundOnStage removes the background
  196. -- of the buttons from the stage
  197.  
  198. on removeButtonBackGroundFromStage
  199.   global buttonBackGroundSprite
  200.   
  201.   set the locH of sprite buttonBackGroundSprite = 1000
  202.   set the locV of sprite buttonBackGroundSprite = 1000
  203.   updateStage
  204. end
  205.  
  206. -- ---------------------------------------------------------------
  207. -- Handler removeSectionButtons removes the section button with the
  208. -- given index from the stage
  209.  
  210. on removeSectionButtons firstButton, lastButton
  211.   global listOfbuttonTextSprites
  212.   
  213.   repeat with i = firstButton to lastButton
  214.     set buttonSprite = getAt(listOfbuttonTextSprites, i)
  215.     if the castNum of sprite buttonSprite > 0 then
  216.       
  217.       set the backcolor of cast the castNum of sprite buttonSprite = 255 -- black
  218.     end if
  219.     
  220.   end repeat
  221.   if the castNum of sprite buttonSprite > 0 then
  222.     removeButtonBackGroundFromStage
  223.   end if
  224.   
  225. end
  226.  
  227. -- Handler removeVisibleButtons removes the section button with the
  228. -- given index from the stage
  229.  
  230. on removeVisibleButtons firstButton, lastButton
  231.   global listOfbuttonTextSprites
  232.   
  233.   repeat with i = firstButton to lastButton
  234.     set buttonSprite = getAt(listOfbuttonTextSprites, i)
  235.     
  236.     set the visible of sprite buttonSprite to FALSE
  237.     
  238.   end repeat
  239.   
  240. end
  241.  
  242. -- ---------------------------------------------------------------
  243. -- Handler placeButtonBackGroundOnStage places onstage the correct
  244. -- background for the current section's buttons (cast member with
  245. -- the correct number of buttons)
  246.  
  247. on placeButtonBackGroundOnStage numSectionButtons
  248.   global buttonBackGroundSprite
  249.   global listOfButtonHs, listOfButtonVs
  250.   
  251.   
  252.   puppetSprite buttonBackGroundSprite, TRUE
  253.   set the stretch of sprite buttonBackGroundSprite = TRUE
  254.   
  255.   set theCast = the number of cast (numSectionButtons & "Buttons")
  256.   set the height of sprite buttonBackGroundSprite = the height of cast theCast
  257.   set the width of sprite buttonBackGroundSprite = the width of cast theCast
  258.   set the castNum of sprite buttonBackGroundSprite = theCast
  259.   
  260.   set H = getAt(listOfButtonHs,numSectionButtons)
  261.   set V = getAt(listOfButtonVs,numSectionButtons)
  262.   set the locH of sprite buttonBackGroundSprite = H
  263.   set the locV of sprite buttonBackGroundSprite = V
  264.   updateStage
  265. end
  266.  
  267. -- ---------------------------------------------------------------
  268. -- Handler placeButton places the button with the given index on
  269. -- stage. A